package com.ylq.todolsitserver.service.impl;

import com.ylq.todolsitserver.entity.Task;
import com.ylq.todolsitserver.mapper.TaskMapper;
import com.ylq.todolsitserver.service.StatsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;

@Service
public class StatsServiceImpl implements StatsService {

    private final TaskMapper taskMapper;

    @Autowired
    public StatsServiceImpl(TaskMapper taskMapper) {
        this.taskMapper = taskMapper;
    }


    @Override
    public Map<String, Integer> getTaskStats() {
        Map<String, Integer> stats = new HashMap<>();
        stats.put("totalTasks", taskMapper.findAll(null, null, null, null).size());
        return stats;
    }
}